#http://qt-project.org/quarterly/view/using_cmake_to_build_qt_projects
cmake_minimum_required (VERSION 2.8) 
add_definitions(-DUNICODE -D_UNICODE -DHAVE_CONFIG_H)
include(${QT_USE_FILE})
set(HEADERS_LIST include/hadoop/Error.h include/hadoop/Closable.h include/hadoop/Factory.h include/hadoop/JobConf.h include/hadoop/MapContext.h include/hadoop/Mapper.h include/hadoop/Partitioner.h include/hadoop/Pipes.hh include/hadoop/RecordReader.h include/hadoop/RecordWriter.h include/hadoop/ReduceContext.h include/hadoop/Reducer.h include/hadoop/SerialUtils.hh include/hadoop/StringUtils.hh include/hadoop/TaskContext.h include/hadoop/TemplateFactory.hh JobConfImpl.h BinaryProtocol.h 	BinaryUpwardProtocol.h 	DownwardProtocol.h 	MsgDefines.h 	Protocol.h 	TextProtocol.h 	TextUpwardProtocol.h 	UpwardProtocol.h)
set(SRC_LIST SerialUtils.cc StringUtils.cc  TimeMillis.cpp HadoopPipes.cpp JobConfImpl.cpp TextProtocol.cpp BinaryProtocol.cpp BinaryUpwardProtocol.cpp ${HEADERS_LIST})
include_directories(${PROJECT_BINARY_DIR}  ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include)
add_definitions(${QT_DEFINITIONS})
SET(hadoopcppclient_QT_HEADERS PingThread.h)
QT4_WRAP_CPP(hadoopcppclient_HEADERS_MOC ${hadoopcppclient_QT_HEADERS})
ADD_LIBRARY(hadoopcppclient STATIC ${SRC_LIST} ${hadoopcppclient_HEADERS_MOC})

if(WIN32)
SET(GLOG_LIB libglog)
SET(TBB_DEBUG_LIB tbb_debug)
SET(TBB_LIB tbb)
elseif(UNIX)
SET(GLOG_LIB glog)
SET(TBB_DEBUG_LIB tbb)
SET(TBB_LIB tbb)
endif()

add_executable (serialize_unitest serialize_unitest.cpp)
target_link_libraries (serialize_unitest hadoopcppclient gtest ${GLOG_LIB} ${CMAKE_THREAD_LIBS_INIT} ${QT_LIBRARIES})
ADD_TEST(serialize_unitest ${CMAKE_CURRENT_BINARY_DIR}/serialize_unitest)

#target_link_libraries(logloader mysqlclient mysqlcppconn gflags glog ${PROTOBUF_LIBRARIES} leveldb snappy profiler)


INSTALL(FILES ${HEADERS_LIST} DESTINATION include/hadoop)
INSTALL_TARGETS(/lib hadoopcppclient)
